using I2.Loc;
using UnityEngine;

public class DevConsoleAchievement : MonoBehaviour
{
	public new UILabel name;

	public UILabel goal;

	public UISprite icon;

	public UISprite background;

	public Achievement achievement;

	public DevConsoleSelectAchievement selector;

	public void Init(Achievement _achievement)
	{
		selector = base.transform.GetComponentInParent<DevConsoleSelectAchievement>();
		UIButton component = GetComponent<UIButton>();
		component.onClick.Add(new EventDelegate(delegate
		{
			selector.Select(achievement);
			selector.PlaySelect(base.gameObject);
		}));
		achievement = _achievement;
		name.text = ScriptLocalization.Get("Achivments/" + _achievement.achievementNameID + "_Title");
		goal.text = ScriptLocalization.Get("Achivments/" + _achievement.achievementNameID + "_Description");
		icon.spriteName = _achievement.achievementIcon;
		if (_achievement.achieved)
		{
			icon.color = Color.white;
			background.color = Color.green;
		}
		else
		{
			icon.color = Color.gray;
			background.color = Color.gray;
		}
	}

	public void Refresh()
	{
		if (achievement.achieved)
		{
			icon.color = Color.white;
			background.color = Color.green;
		}
		else
		{
			icon.color = Color.gray;
			background.color = Color.grey;
		}
	}
}
